package com.dnjn.happiness.emo.api.factory;

import com.dnjn.happiness.common.core.domain.R;
import com.dnjn.happiness.emo.api.RemoteUserHcmQxPtdataService;
import com.dnjn.happiness.emo.api.domain.UserHcmQxPtdata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteUserHcmQxPtdataFactory implements FallbackFactory<RemoteUserHcmQxPtdataService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteUserHcmQxPtdataFactory.class);

    @Override
    public RemoteUserHcmQxPtdataService create(Throwable throwable) {
        log.error("调用UserHcmQxPtdata服务失败：{}" + throwable.getMessage());
        return new RemoteUserHcmQxPtdataService() {
            @Override
            public R<List<UserHcmQxPtdata>> selectAttendance(Long userId, String rtype, String source) {
                return R.fail("查询考勤记录失败：{}" + throwable.getMessage());
            }
        };
    }

}
